package com.why.catchMsg.controller;

import com.why.catchMsg.service.CacheService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(description = "测试用的controller")
@RestController
public class TestController {

    @Autowired
    CacheService cacheService;

    @GetMapping(value = "test")
    public String testHello(){
        return  "hello world";
    }

    @GetMapping(value = "put")
    public String putCache(){
        cacheService.putCode("123","hello world2");
        return "d";
    }
    @GetMapping(value = "get")
    public String getCode(String key){
       String value=String.valueOf(cacheService.getCode(key));
       return  value;
    }

}
